<template>
    <div class="top-bar">
        {{ title }}
        <div class="top-bar-btns" v-if="isBlack">
            <img @click="fanhui" src="@/assets/return.png" alt="" class="return" />
        </div>
    </div>
</template>

<script>
export default {
    name: "home",
    props: {
        title: {
            type: String,
            required: true,
        },
        isBlack: {
            type: Boolean,
            default: () => false,
        },
    },
    methods: {
        fanhui() {
            this.$router.go(-1);
        },
    },
};
</script>

<style lang="scss" scoped>
.top-bar {
    position: sticky;
    z-index: 99;
    top: 0;
    left: 0;
    width: 100%;
    height: 44px;
    text-align: center;
    line-height: 44px;
    font-size: 16px;
    font-weight: 500;
    color: #333;
    background: #fff;
    border-bottom: 1px solid #f4f4f4;
    .top-bar-btns {
        position: absolute;
        left: 15px;
        top: 0px;
        height: 44px;
        display: flex;
        align-items: center;
        .return {
            width: 9px;
            height: 16px;
            object-fit: contain;
        }
    }
}

//超过768px时，修改字体
@media screen and (min-width: 768px) {
    .top-bar {
        font-size: 22px;
    }
}
</style>
